package com.unicomcz.query;

import java.sql.ResultSet;
import java.util.List;

import com.unicomcz.DetailPageAction;

public class ZcQueryAction extends DetailPageAction
{
    private String serialNumber;

    /**
     * @return the serialNumber
     */
    public String getSerialNumber()
    {
        return serialNumber;
    }

    /**
     * @param serialNumber the serialNumber to set
     */
    public void setSerialNumber(String serialNumber)
    {
        this.serialNumber = serialNumber;
    }

    /* (non-Javadoc)
     * @see com.unicomcz.DetailPageAction#getSqlStr()
     */
    @Override
    public String getSqlStr()
    {
        String sql = "select serial_number,zc,begin_date,end_date from dls_hm_zc where serial_number=? and sysdate between to_date(begin_date,'yyyy-mm-dd') and  to_date(end_date,'yyyy-mm-dd')+1";
        return sql;
    }
    public Object[] getParams() {
        return new Object[]{serialNumber};
    }
    protected void regQueryParam() throws Exception{      
        //log.debug(userInfo.getDepartCode());
        pstmt.setString(1, serialNumber);
    }
    protected void rs2List(ResultSet rs,List out) throws Exception{
        ZCBean t = new ZCBean();
        t.setSerialNumber(rs.getString(1));
        t.setZc(rs.getString(2));
        t.setBeginDate(rs.getString(3));
        t.setEndDate(rs.getString(4));
        out.add(t);
    }

}
